{#

This file is part of the Sonata package.

(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

#}

{% extends base_template %}

{% block actions %}
    <li>{% include 'SonataAdminBundle:Button:edit_button.html.twig' %}</li>
    <li>{% include 'SonataAdminBundle:Button:history_button.html.twig' %}</li>
    <li>{% include 'SonataAdminBundle:Button:list_button.html.twig' %}</li>
    <li>{% include 'SonataAdminBundle:Button:create_button.html.twig' %}</li>
{% endblock %}

{% block tab_menu %}{{ knp_menu_render(admin.sidemenu(action), {'currentClass' : 'active', 'template': admin_pool.getTemplate('tab_menu_template')}, 'twig') }}{% endblock %}

{% block show %}
    <div class="sonata-ba-view">

        {{ sonata_block_render_event('sonata.admin.show.top', { 'admin': admin, 'object': object }) }}

        {% for name, view_group in admin.showgroups %}
            <table class="table table-bordered">
                {% if name %}
                    <thead>
                        {% block show_title %}
                            <tr class="sonata-ba-view-title">
                                <th colspan="2">
                                    {{ admin.trans(name) }}
                                </th>
                            </tr>
                        {% endblock %}
                    </thead>
                {% endif %}

                <tbody>
                    {% for field_name in view_group.fields %}
                        {% block show_field %}
                            <tr class="sonata-ba-view-container">
                                {% if elements[field_name] is defined %}
                                    {{ elements[field_name]|render_view_element(object) }}
                                {% endif %}
                            </tr>
                        {% endblock %}
                    {% endfor %}
                </tbody>
            </table>
        {% endfor %}

        {{ sonata_block_render_event('sonata.admin.show.bottom', { 'admin': admin, 'object': object }) }}

    </div>
{% endblock %}
